<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>SWFAddress Website</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="swfobject/swfobject.js"></script>
        <script type="text/javascript" src="swfaddress/swfaddress.js"></script>
        <script type="text/javascript">
        // <![CDATA[
            
            function getTransport() {
                if (window.XMLHttpRequest) {
                    return new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    try {
                        return new ActiveXObject('Msxml2.XMLHTTP');
                    } catch(e) {
                        return new ActiveXObject('Microsoft.XMLHTTP');
                    }
                }
            }

            function updateContent(html) {
                var content = document.getElementById('content');
                if (asual.util.Browser.isIE()) {
                    var _content = document.getElementById('_content');
                    if (_content == null) {
                        var _content = content.cloneNode(false);
                        _content.id = '_content';
                        _content.style.position = 'absolute';
                        _content.style.top = content.offsetTop;
                        _content.style.left = '50%';
                        _content.style.width = content.offsetWidth;
                        _content.style.marginLeft = -content.offsetWidth/2;
                        document.body.appendChild(_content);
                    }
                    _content.innerHTML = html;
                    content.style.height = _content.offsetHeight;
                } else {
                    content.innerHTML = html;
                }
                while (html.match(/(<script[^>]+javascript[^>]+>\s*(\/\/*<!\[CDATA\[)?(<!--)?\s*)/i)) {
                    html = html.substr(html.indexOf(RegExp.$1) + RegExp.$1.length);
                    if (!html.match(/((\/\/ *\]\]>)?(-->)?\s*<\/script>)/)) break;
                    block = html.substr(0, html.indexOf(RegExp.$1));
                    html = html.substring(block.length + RegExp.$1.length);
                    eval(block);
                }
            }
            
            function updateChange(xhr) {
                if (xhr.readyState == 4) {
                    if (xhr.status == 200) {
                        updateContent(xhr.responseText);
                    } else {
                        alert('Error: ' + xhr.status + '!');
                    }
                }
            }
            
            function handleChange(event) {
                updateContent('');
                var xhr = getTransport();
                xhr.onreadystatechange = function() {
                    updateChange(xhr);
                }
                xhr.open('get', 'datasource/' + (event.value == '/' ? 'home' : event.value.replace(/\//g, '')) + '.xml', true);
                xhr.send('');
                var title = 'SWFAddress Website';
                for (var i = 0; i < event.pathNames.length; i++) {
                    title += ' / ' + event.pathNames[i].substr(0,1).toUpperCase() + event.pathNames[i].substr(1);
                }
                SWFAddress.setTitle(title);
            }
            
            SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);
            
        // ]]>
        </script>
        <style type="text/css">
            html {
                height: 100%;
            }
            body {
                height: 100%;
                font: 86% Arial, "Helvetica Neue", sans-serif;
                margin: 0;
                padding: 0;
                background: #CCCCCC;
            }
            a {
                color: #205BAF;
            }
            .container {
                width: 480px;
                min-height: 100%;
                margin: 0 auto;
                background: #FFFFFF;
            }
            * html .container {
                height: 100%;
            }
            .header {
                height: 80px;
                overflow: hidden;
                margin: 0 0 40px;
            }
            .header h1 {
                font-size: 260%;
                margin: 18px 42px;
                letter-spacing: -2px;
                color: #CCCCCC;
            }            
            .content {
                margin: 0 40px;
                position: relative;
                left: 0;
                top: 0;
                width: 400px;
            }
            .content ul {
                margin: 0 0 0 66px;
                padding: 0;
                position: absolute; 
                left: 0;
                top: -40px;
            }
            .content li {
                list-style: none;
                display: inline;
                font-size: 150%;
                font-weight: bold;
                text-transform: uppercase;
                padding-right: 8px;
                letter-spacing: -1px;
            }
            .content li a {
                text-decoration: none;
                color: #000;
            }
            .content li a.selected {
                color: #CC0000;
            }
            .content div, .content p {
                margin: 0 0 12px;
            }
            .footer {
                height: 80px;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div id="header" class="header">
                <h1>SWFAddress Website</h1>
            </div>
            <div id="content" class="content"></div>
            <div id="footer" class="footer"></div>
        </div>
        <script type="text/javascript">
        // <![CDATA[
            (new SWFObject('header.swf', 'swfheader', '480', '80', '8', '#CCCCCC')).write('header');
            (new SWFObject('footer.swf', 'swffooter', '480', '80', '8', '#CCCCCC')).write('footer');
        // ]]>
        </script>
    </body>
</html>
